package com.pocket.insight.entity;

import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonUnwrapped;
import com.pocket.insight.base.enums.AreaEnum;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Map;

/**
 * 描述：
 *
 * @author shuize
 * @create 2024/12/24
 */
@Data
public class AppRelation implements Serializable {
    private Long          appId;
    @JsonAlias({"id"})
    private Long          sourceId;
    private Type          type;
    private Boolean       keepDatasetAcl;
    private Status        status;
    @JsonUnwrapped
    private Options       options;
    private Long          sourceIdTenant;
    private Long          createdBy;
    private LocalDateTime createdAt;
    private Long          updatedBy;
    private LocalDateTime updatedAt;

    @Data
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class Options implements Serializable {
        private static final long serialVersionUID = 1;
        private String                       title;
        private AreaEnum                     area;
        private Map<Long, String>            datasetIdTitles;
        private Map<Long, Map<Long, String>> datasetRelations;
        private String                       tenantName;
    }

    public enum Status {
        pending,
        approved;
    }
}
